// *** SITE OBJECT *** //
// Controls the site and 
//
// @project: GoldenShield
// @author: Anders Ipsen
// @version: 1.0

var site = {
    boxShown: false, //Tells if the content box is shown
    
    createMenu: function() {//appends the menuBox and adds css for positioning the menuBox div
        $('#scene').append("<div id='rightMenu'><ul><li id='home'><a href='#'><img src='img/hpimg/home.png' /></a></li><li id='howTo'><a href='#'><img src='img/hpimg/howTo.png' /></a></li><li id='about'><a href='#'><img src='img/hpimg/about.png' /></a></li></ul></div>");
        $('#rightMenu').css({position: 'absolute', left: '808px', top: '-4px'});
        $('#rightMenu li').css({listStyleType: 'none', marginBottom: '8px'});
        $('#rightMenu img').css({border: 'none'});
        $('#scene').append("<div id='menuBox'></div>");
        $('#menuBox').css({display: 'none', border: '4px solid #191919', zIndex: '10001', borderRadius: '15px', height: '500px', opacity: '1', width: '500px', position: 'absolute', top: '50px', left: '150px', backgroundColor: '#E9E9E9' });
        site.eventListener();
    },
    menuAbout: function() {//calls the about info
        site.showBox('<img src="img/menuimg/about.png" />');
    },
    menuHome: function() {//closes the menuBox div
        this.removeBox();
    },
    menuHowTo: function() {//calls the game instructions
        site.showBox('<img src="img/menuimg/controlkeys.png" />');
    },
    removeBox: function() {//removes the menuBox div
        $('#menuBox').fadeOut(400);
        site.boxShown = false;
    },
    showBox: function(msg) {//this functions fades the box in and parses the html
        $('#menuBox').fadeIn(400);
        $('#menuBox').html(msg);
        site.boxShown = true;
    },
    eventListener: function() {//listens for click on the li elements
        $('#home').click(function() {
            site.menuHome(); 
        });
        $('#about').click(function() {
            site.menuAbout(); 
        });
        $('#howTo').click(function() {
            site.menuHowTo(); 
        });
        $('#menuBox').click(function() {
            site.removeBox(); 
        });
    }
};